#include <vector>
#include "test.hpp"
#include "throw_exception_behavior.hpp"
#include "argument_matcher.hpp"
#include "exact_argument_matcher.hpp"
#include "unexpected_invocation_exception.hpp"

using std::vector;

namespace vimock {
class my_exception : public std::exception {
};
TEST_CASE(replay_should_throw_exception_set_when_invocation_match) {
	object obj(1);
	object func(2);
	argument_matcher_vector argument_matchers(new vector<argument_matcher>());
	invocation_matcher inv_matcher(new _invocation_matcher(obj, func, argument_matchers));	
	object_vector arguments(new vector<object>());
	invocation inv(new _invocation(obj, func, arguments));
	
	throw_exception_behavior behavior(inv_matcher, my_exception());
	assert_thrown(my_exception, behavior.replay(inv));
}

TEST_CASE(replay_throw_exception_behavior_should_throw_unexpected_invocation_exception_when_invocation_mismatch) {
	argument_matcher_vector argument_matchers(new vector<argument_matcher>());
	invocation_matcher inv_matcher(new _invocation_matcher(0, 0, argument_matchers));
	object_vector arguments(new vector<object>());
	invocation inv(new _invocation(1, 1, arguments));

	throw_exception_behavior behavior(inv_matcher, my_exception());
	assert_thrown(unexpected_invocation_exception, behavior.replay(inv));
}
}
